<!DOCTYPE html>
<html lang="en">

 <head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <link rel="stylesheet" type="text/css" href="css/图片裁剪.css"/>
  <link rel="stylesheet" type="text/css" href="./lib/layui/css/layui.css"/>
  <link rel="stylesheet" href="./lib/cropper/cropper.css" />
  <link rel="stylesheet" type="text/css" href="assets/css/user_avatar.css"/>
  <script src="lib/jquery.js" type="text/javascript" charset="utf-8"></script>
  <script src="lib/cropper/Cropper.js" type="text/javascript" charset="utf-8"></script>
  <script src="lib/cropper/jquery-cropper.js" type="text/javascript" charset="utf-8"></script>
 </head>
 <body>
   <!-- 卡片区域 -->
   <div class="layui-card">
    <div class="layui-card-header">更换头像</div>
    <div class="layui-card-body">
     <div class="outer-box">
      <div class="cropper-box">
       <img id="image" src="img/sample2.jpg" />
      </div> 
      <!-- 预览区域 -->
      <div class="preview-box">
       <div class="img-preview w100"></div>
       <p>100 x 100</p>
       <div class="img-preview w50"></div>
       <p>50 x 50</p>
      </div>
     </div>
	 <input type="file" class="file" />
		<button class="layui-btn" id="btnChooseImage">上传</button>
	      <button class="layui-btn layui-btn-danger" id="btnCreateAvatar">确定</button>
	    </div>
	    </div>
	   </div>	 
	   <!-- 文件选择框 -->
	   <!-- 通过 accept 属性控制选择的文件类型 -->
	   <input type="file" id="iptAvatar" accept="image/jpeg,image/png,image/bmp,image/gif" />	 
	  </body>
	  <script src="layui/layui.js"></script>
	 <script src="js/perapi.js"></script>
	 <script src="js/图片裁剪.js"></script>
</html>